package personnal.blogprinter.htmlparser;

import java.util.HashSet;
import java.util.Set;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class CountingElementsHandler extends DefaultHandler {

    private int documentCount = 0;
    private Set<String> tags = new HashSet<String>();

    @Override
    public void startDocument() throws SAXException {
        this.documentCount++;
    }

    @Override
    public void startElement(String uri, String lname, String name, Attributes attrs) throws SAXException {
        this.tags.add(name);
    }

    public Set<String> getTags() {
        return this.tags;
    }

    public int getDocumentCount() {
        return this.documentCount;
    }
}
